package utils;

public class Constants {
	
	public static String FOLDER_PATH = "D:\\knx\\Src\\Java\\Tri\\files\\";
	
	public static String LOG_FILENAME = FOLDER_PATH + "log.dat";

	
	/*
	 * FOR NODE STORAGE
	 */
	public static int ROOT_NODEID = 0; 
	
	public static int ROOT_INODEPAGEID = 1;
	
	public static int ROOT_SET_INODEPAGEID = 1;
	
	public static String ROOT_TAGNAME = "root";
	
	public static String NODE_FILENAME = FOLDER_PATH + "node.dat";
	
	public static int NODE_BUFFER_SIZE = 10000;
	
	public static int NODE_PAGESIZE = 4096;
		
	public static int NODE_PAGEBUFFER_SIZE = 10000; 
	
	/*
	 * FOR SET STORAGE
	 */
	
	public static String SET_FILENAME = FOLDER_PATH + "set.dat";
	
	public static String SET_FILENAME_TEMP = FOLDER_PATH + "set_temp.dat";
	
	public static int SET_BUFFER_SIZE = 10000;
	
	public static int SET_PAGESIZE = 4096;
	
	public static int SET_PAGEBUFFER_SIZE = 10000;
	
	public static String SET_INODE_FILENAME = FOLDER_PATH + "set_inode.dat";
	
	public static String SET_INODE_FILENAME_TEMP = FOLDER_PATH + "set_inode_temp.dat";
	
	public static int SET_INODE_PAGESIZE = 4096;
	
	public static int SET_INODE_PAGEBUFFER_SIZE = 10000;
	
	/*
	 * FOR NODE INDEX STORAGE
	 */
	
	public static String NODE_IDX_FILENAME = FOLDER_PATH + "node_idx.dat";
	
	public static String NODE_IDX_META_FILENAME = FOLDER_PATH + "node_idx_meta.dat";
	
	public static int NODE_IDX_BUFFER_SIZE = 10000;
	
	public static int NODE_IDX_META_PAGESIZE = 4096;
	
	public static int NODE_IDX_PAGESIZE = 4096;
	
	public static int NODE_IDX_PAGEBUFFER_SIZE = 10000;
	
	/*
	 * FOR TAG INDEX STORAGE
	 */
	
	public static String TAG_IDX_FILENAME = FOLDER_PATH + "tag_idx.dat";
	
	public static String TAG_IDX_FILENAME_TEMP = FOLDER_PATH + "tag_idx_temp.dat";
	
	public static int TAG_IDX_MAPBUFFER_SIZE = 10000;
	
	public static int TAG_IDX_PAGESIZE = 4096;
	
	public static int TAG_IDX_PAGEBUFFER_SIZE = 10000;
	
	public static String TAG_IDX_INODE_FILENAME = FOLDER_PATH + "tag_idx_inode.dat";
	
	public static String TAG_IDX_INODE_FILENAME_TEMP = FOLDER_PATH + "tag_idx_inode_temp.dat";
	
	public static int TAG_IDX_INODE_PAGESIZE = 4096;
	
	public static int TAG_IDX_INODE_PAGEBUFFER_SIZE = 5000;
	
	public static String TAG_BPTree_FILENAME = FOLDER_PATH + "tag_btree.dat";
	
	public static int TAG_BPTree_ORDER = 300;
	
	public static int TAG_BPTree_PAGESIZE = 4096;
	
	public static int TAG_BPTree_PAGEBUFFER_SIZE = 10000;
	
	/*
	 * FOR ITEM INDEX STORAGE
	 */
	
	public static String ITEM_IDX_FILENAME = FOLDER_PATH + "item_idx.dat";
	
	public static int ITEM_IDX_MAPBUFFER_SIZE = 10000;
	
	public static int ITEM_IDX_PAGESIZE = 4096;
	
	public static int ITEM_IDX_PAGEBUFFER_SIZE = 10000;
	
	public static String ITEM_IDX_INODE_FILENAME = FOLDER_PATH + "item_idx_inode.dat";
	
	public static int ITEM_IDX_INODE_PAGESIZE = 4096;
	
	public static int ITEM_IDX_INODE_PAGEBUFFER_SIZE = 10000;
	
	public static String ITEM_BPTree_FILENAME = FOLDER_PATH + "item_btree.dat";
	
	public static int ITEM_BPTree_ORDER = 300;
	
	public static int ITEM_BPTree_PAGESIZE = 4096;
	
	public static int ITEM_BPTree_PAGEBUFFER_SIZE = 10000;
	
	
	/*
	 * UTILS
	 */
	public static int INT_SIZE_2POWER = 2;
	
	public static int BYTE_SIZE = Byte.SIZE;
	
	public static int INT_SIZE = Integer.SIZE / Byte.SIZE;
	
	public static int LONG_SIZE = Long.SIZE / Byte.SIZE;
	
	public static int W_ERROCODE = Integer.MIN_VALUE;
	
	public static int HASH_UPPERBOUND = 1000;
	//public static int IO_ERRORCODE = Integer.MIN_VALUE;
	
	private static byte[] _zeros = null;
	
	public static byte[] zeros() {
		if (_zeros == null) {
			_zeros = new byte[INT_SIZE];
			Converter.Int2Bytes(0, _zeros, 0);
		}
		return _zeros;
			
	}
}
